#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
	int n, x;
	cin >> n;

	int sum = 0, ans = INT_MIN;
	for (int i = 1; i <= n; i++) {
		cin >> x;
		sum += x;
		if (sum >= 0)
			ans = max(ans, i);
	}
	cout << ans;
	return 0;
}
